package engine.gameObject;

import engine.collider.bounds.BoundingElement;

public class DynamicObject extends GameObject{

//	private double[] newPosition;
	private double[] velocity;
	
	public DynamicObject() {
		super();
		
//		newPosition = new double[]{0, 0, 0};
		velocity = new double[]{0, 0, 0};
	}
	
	
	public void updateAbs(float timeElapsed) {
		update(timeElapsed);
	}
	
//	@Override
//	public void lateUpdateAbs(float timeElapsed) {
//		lateUpdate(timeElapsed);
//		
//		setPosition(newPosition);
//	}
	public void move(double timeElapsed) {
		setPosition(getPosX() + timeElapsed * velocity[0] * BoundingElement.SPEED_MULTIPLY, getPosY() + timeElapsed * velocity[1] * BoundingElement.SPEED_MULTIPLY, getPosZ() +
				timeElapsed * velocity[2] * BoundingElement.SPEED_MULTIPLY);
	}
	
	@Override
	public void renderAbs(float timeElapsed) {
		setRendered(false);
		super.renderAbs(timeElapsed);
	}
	
	public void update(float timeElapsed) {}
	
//	@Override
//	public void setPosition(double x, double y, double z) {
//		super.setPosition(x, y, z);
//		
//		setNewPosition(x, y, z);
//	}
	
//	public void setNewPosition(double x, double y, double z) {
//		this.newPosition[0] = x;
//		this.newPosition[1] = y;
//		this.newPosition[2] = z;
//	}
//	
//	public double[] getNewPosition() {
//		return newPosition;
//	}
	
	public void setVelocity(double x, double y, double z) {
		this.velocity[0] = x;
		this.velocity[1] = y;
		this.velocity[2] = z;
	}
	
	public void setVelocity(double[] velocity) {
		for(int i = 0; i < velocity.length; i++) {
			this.velocity[i] = velocity[i];
		}
	}
	
	public double[] getVelocity() {
		return velocity;
	}
}
